import pygame

class EndPlayer(pygame.sprite.Sprite):
    def __init__(self):
        super().__init__()

        #结算玩家的动画帧
        self.end_player_1 = pygame.transform.scale(pygame.image.load('game_custom/kunkun/end1.png').convert_alpha(),(68,84))
        self.end_player_2 = pygame.transform.scale(pygame.image.load('game_custom/kunkun/end2.png').convert_alpha(),(68,84))
        self.end_player_3 = pygame.transform.scale(pygame.image.load('game_custom/kunkun/end3.png').convert_alpha(),(68,84))
        self.end_player_4 = pygame.transform.scale(pygame.image.load('game_custom/kunkun/end4.png').convert_alpha(),(68,84))
        self.end_player_5 = pygame.transform.scale(pygame.image.load('game_custom/kunkun/end5.png').convert_alpha(),(68,84))

        #动画
        self.end_player = [self.end_player_1,self.end_player_2,self.end_player_3,self.end_player_4,self.end_player_5]
        #索引
        self.end_player_index = 0
        #当前帧
        self.image = self.end_player[self.end_player_index]
        self.rect = self.image.get_rect(
            center = (720, 540))

    def animation_state(self):
        self.end_player_index += 0.1
        if self.end_player_index >= len(self.end_player):
            self.end_player_index = 0
        self.image = self.end_player[int(self.end_player_index)]

    def update(self):
        self.animation_state()